Skip to content

fix: Add TypeScript type definitions for Sequelize DataTypes (VECTOR, HALFVEC, SPARSEVEC)#31

Open
kai63001 wants to merge 1 commit intopgvector:masterfrom
kai63001:fix/sequelize-typescript-datatypes
Open

fix: Add TypeScript type definitions for Sequelize DataTypes (VECTOR, HALFVEC, SPARSEVEC)#31
kai63001 wants to merge 1 commit intopgvector:masterfrom
kai63001:fix/sequelize-typescript-datatypes

Conversation

@kai63001
Copy link

Problem

TypeScript users get type errors when using DataTypes.VECTOR(), DataTypes.HALFVEC(),
or DataTypes.SPARSEVEC() because the type definitions don't augment Sequelize's DataTypes.

Error: Property 'VECTOR' does not exist on type 'typeof DataTypes'

Solution

Added module augmentation in types/sequelize/index.d.ts to extend Sequelize's
DataTypes namespace with the vector types.

Changes

  • Added VectorDataTypeConstructor, HalfvecDataTypeConstructor, SparsevecDataTypeConstructor interfaces
  • Added module augmentation for sequelize to declare the types on DataTypes namespace
  • Supports both DataTypes.VECTOR(3) and DataTypes.postgres.VECTOR(3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant